package cn.jinzhu.openfeign.service;

import cn.jinzhu.entity.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;
@Component
//不用加前缀要继承FallbackFactory<HelloService>  服务降级
public class HelloServiceFallBackFactory implements FallbackFactory<HelloService> {
    @Override
    public HelloService create(Throwable throwable) {
        return new HelloService() {
            @Override
            public String hello() {
                return "error";
            }

            @Override
            public String hello1(String name) {
                return "error";
            }

            @Override
            public User hello3(User user) {
                return null;
            }

            @Override
            public String delete1(Integer id) {
                return null;
            }

            @Override
            public String GetUserByName(String name) throws UnsupportedEncodingException {
                return null;
            }
        };
    }
}
